import Cookies from 'js-cookie'

/**
 * localStorage cookies区别
 * 大小
 * 5M   4k
 * 时效
 *  localStorage：永久储存
 *  cookies: 有效期内储存
 * 存储差别
 * localStorage 不会自行携带token
 * cookies 会自行携带token
 *
 */

const TokenKey = 'hrsass-105-token'

export function getToken() {
  // 类似于 localStorage.getItem(key)
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  // 类似于 localStorage.setItem(key,value)
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  // 类似于 localStorage.removeItem(key)
  return Cookies.remove(TokenKey)
}
